'use strict';

const db = uniCloud.database()
exports.main = async (event, context) => {
	const collection = db.collection('user')
	//event为客户端上传的参数
	const { _id } = event
	const obj = {}
	for (let key in event) {
		if (key !== '_id' ) {
			obj[key] = event[key]
		}
	}
	const res = await collection.doc(_id).update(obj)
	//返回数据给客户端
	return {
		code: 0,
		data: res
	}
};
